﻿using System;
using System.Collections.Generic;
using System.Text;
using T.FAS.Runtime.Metadata.Entity;
using T.FAS.Runtime.Action.SPI;
using T.FAS.Runtime.Base.Entity;
using T.FAS.Runtime.DataAccess.Engine;
using T.FAS.Runtime.DataAccess.Service;
using T.FAS.Runtime.Metadata.Entity.DataModel;
using T.FAS.Runtime.Expression.Entity;
using T.FAS.Runtime.Expression.Service;
using T.FAS.Runtime.Metadata.Client;

namespace T.FAS.Runtime.Action.Engine
{
    class ActionExecuteEngine: AbsActionExecuteEngine
    {       
        public ActionExecuteEngine()
        {
            GetDefaultConfig();
        }

        public ActionExecuteEngine(ActionExecuteEngineConfig config)
        {
            this.config = config;
        }

        public override TResult Execute(ActionExecContext context)
        {
            var isNeedRemoteInvoke = ActionRouterManager.Instance.IsRemoteInovke(context);
            if (isNeedRemoteInvoke)
            {
                return RemoteInvoke(context);
            }
            else
            {
                return LocalInvoke(context);
            }
        }
    }
}
